package com.aw.guiguzi.bean

import com.aw.baselib.util.AwDataUtil
import com.aw.baselib.util.AwDateUtil

class LoginRecordItemBean {
    /**
     * id : 1024
     * logType : 1
     * userId : 666
     * userType : 2
     * traceId : 89aca178-a370-411c-ae02-3f0d672be4ab
     * username : yudao
     * result : 1
     * userIp : 127.0.0.1
     * userAgent : Mozilla/5.0
     * createTime :
     */
    var id: String? = null
    var logType: String? = null
    var userId: String? = null
    var userType: String? = null
    var traceId: String? = null
    var username: String? = null
    var result: String? = null
    var userIp: String? = null
    var userAgent: String? = null
    var createTime: String? = null
        get() = if (AwDataUtil.isEmpty(field)) {
            ""
        } else AwDateUtil.formatUnixTime(field)
    val loginTypeStr: String
        get() {
            if (!AwDataUtil.isEmpty(logType)) {
                if (logType == "100") {
                    return "登录"
                } else if (logType == "202") {
                    return "强退"
                } else if (logType == "200") {
                    return "自退"
                }
            }
            return "--"
        }
    val loginResultStr: String
        get() {
            if (!AwDataUtil.isEmpty(result)) {
                if (result == "0") {
                    return "成功"
                } else if (result == "10") {
                    return "账密错误"
                } else if (result == "20") {
                    return "禁用"
                } else if (result == "30") {
                    return "验证码不存在"
                } else if (result == "31") {
                    return "验证码错误"
                }
            }
            return "--"
        }
}